package com.atguigu.gmall.util;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2021/8/2 14:16
 */
public class ThreadUtil {
    
    public static ThreadPoolExecutor getThreadPool(){
        return new ThreadPoolExecutor(
            100,  // 核心线程数
            300, //上限
            1,  // 保或时间
            TimeUnit.MINUTES,
            new LinkedBlockingDeque<>(100) // 超过上限之后的线程存储到这个队列中
        );
    }
}
